import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
import Pages from 'vite-plugin-pages'
export default defineConfig({
	plugins: [
		vue(),
		VueSetupExtend(),
		Pages({
			dirs: 'src/views',
			exclude: ['**/components/*.vue', '**/layout/*.vue'],
		}),
		Components({
			dirs: ['src/components', 'src/views', 'src/layout'],
			resolvers: [AntDesignVueResolver({ importStyle: false })],
		}),
	],
	base: '/',
	resolve: {
		alias: {
			'@': '/src',
		},
	},
	server: {
		open: true,
		proxy: {
			'/api': {
				target: 'http://127.0.0.1:4433',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, ''),
			},
		},
	},
})
